-
Notifications
You must be signed in to change notification settings - Fork 178
Add addons table #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add addons table #1337
Conversation
61c521c
to
dd8cc31
Compare
a006852
to
bd08a5e
Compare
AND addon.valid_from <= now() | ||
AND (addon.valid_to IS NULL OR addon.valid_to > now()) | ||
) a ON true | ||
WHERE ut.user_id = $1 AND t.id = $2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create view that will precalculate addon values per team so we dont need to do this sum in multiple queries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe sqlc comes with some way how to re-use part of query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, this simplified few things <3
ctx := c.Request.Context() | ||
|
||
teams, err := a.sqlcDB.GetTeamsWithUsersTeamsWithTier(ctx, userID) | ||
teams, err := dbapi.GetTeamByUser(ctx, a.sqlcDB, userID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetTeamByUser
-> GetTeamsByUser
bd08a5e
to
36351ab
Compare
Note
Adds "addons" table and computed
team_limits
view, replacesTier
with unifiedTeam
+TeamLimits
types across API/auth/handlers/orchestrator, and updates queries/cache accordingly.public.addons
table andteam_limits
view aggregating tier limits + active addons.teams__get.sql
returningTeam
+TeamLimit
; remove old tier query files.internal/db/types
:Team
,TeamLimits
,TeamWithDefault
; helpersNewTeam
,GetTeamsByUser
.GetTeamAuth
,GetTeamByIDAndUserIDAuth
) to return*types.Team
.*types.Team
(drop tier from cache API).*types.Team
.GetTeamAndTier
withGetTeamAndLimits
; propagate*types.Team
through all sandbox/template endpoints.team.Limits
.team.Limits
for concurrency checks and sandbox/build params.team.LimitResources
now accepts*types.TeamLimits
.Tier
schema and generated code; simplifyTeam
(tier remains string field only).Team
and team/cluster contexts.*types.Team
.Written by Cursor Bugbot for commit 6cdf1cd. This will update automatically on new commits. Configure here.